Skip to content

Add integration test#178

Merged
julien-nc merged 17 commits intomainfrom
enh/noid/oauth-integration-test
Mar 16, 2026
Merged

Add integration test#178
julien-nc merged 17 commits intomainfrom
enh/noid/oauth-integration-test

Conversation

@julien-nc
Copy link
Member

@julien-nc julien-nc commented Mar 14, 2026

  • Use phpunit 11 to get the external dependency feature (used in integration tests)
  • Bump min NC version to 33 and max to 34 because phpunit 11 only supports php >= 8.2 and NC 33 is the first to drop support for php 8.1.
  • Update composer dependencies
  • Add oauth integration test that performs a full oauth flow with credentials stored as repo secrets (with totp support because we can't perform device validation per email 😁)
  • Add other integration tests that depend on the oauth test so we know we have a token stored in the DB
    • Get notifications for the dashboard widget
    • Search for the search providers
    • Issue/pr reference provider
    • Code reference provider
  • Fix issue in the issue/pr reference provider: When resolving links to a comment that does not exist (like https://github.com/nextcloud/server/issues/1#issuecomment-1), the reference object contained an invalid value for the comment which resulted in a crash of the widget. That's solved by acting like it's just an issue/pr link when the comment was not found.

@julien-nc julien-nc force-pushed the enh/noid/oauth-integration-test branch 12 times, most recently from b63d540 to a9c420a Compare March 14, 2026 16:19
@julien-nc julien-nc changed the title Add oauth integration test Add integration test Mar 14, 2026
@julien-nc julien-nc force-pushed the enh/noid/oauth-integration-test branch 5 times, most recently from ca3b0ce to 886e029 Compare March 15, 2026 00:25
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
…he oauth one

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
…rom nextcloud/.github

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc julien-nc force-pushed the enh/noid/oauth-integration-test branch from 886e029 to 9f9b46e Compare March 15, 2026 00:28
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc julien-nc force-pushed the enh/noid/oauth-integration-test branch from 9f9b46e to 5631c35 Compare March 15, 2026 00:36
@julien-nc julien-nc marked this pull request as ready for review March 15, 2026 00:40
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc julien-nc force-pushed the enh/noid/oauth-integration-test branch 2 times, most recently from 5130efc to 6aee41a Compare March 15, 2026 17:17
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc julien-nc force-pushed the enh/noid/oauth-integration-test branch from 6aee41a to 07a7f7b Compare March 15, 2026 17:18
@julien-nc julien-nc requested a review from oleksandr-nc March 15, 2026 17:19
@oleksandr-nc
Copy link
Contributor

Unfortunetly, I can't test this, as tests are not working for my account(WebAuthn has a priority over TOTP by default on GitHub or on my acc?)
Should I push a commit that fixes it and navigates to TOTP if it makes sense?

It will look like this:

$twoFactorForm = GitHubHtml::findTwoFactorForm($selector);
if ($twoFactorForm === null) {
    // WebAuthn/passkey page may be shown instead of TOTP, navigate to TOTP alternative
    $totpPage = $this->navigateToTotpPage($currentUrl, $currentBody);
    $currentUrl = $totpPage['url'];
    $currentBody = $totpPage['body'];

    ['selector' => $selector, 'title' => $title] = $this->getPageContext($currentBody);
    $twoFactorForm = GitHubHtml::findTwoFactorForm($selector);
    if ($twoFactorForm === null) {
        $this->fail('Could not find the GitHub 2FA form after navigating away from WebAuthn page. Page title: ' . $title . '. URL: ' . $currentUrl);
    }
}

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc
Copy link
Member Author

Should I push a commit that fixes it and navigates to TOTP if it makes sense?

Sure go ahead, as long as you don't break it with the user used in the CI runs, all good 😁

Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
@oleksandr-nc
Copy link
Contributor

From my POV - this HUGE PR is READY

@julien-nc julien-nc merged commit 036e2bf into main Mar 16, 2026
25 checks passed
@julien-nc julien-nc deleted the enh/noid/oauth-integration-test branch March 16, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants